<?
class SpeedCheck
{
	var $headtime = 0;
	function SpeedCheck()
	{
		list($msec,$sec)=explode(chr(32),microtime()); 
		$this->headtime=$sec+$msec;
	}
	function Draw()
	{
		//list($msec,$sec)=explode(chr(32),microtime());
		//print "<q style=\"position:relative; right:0; bottom:0;font-size:9px;color:#666666;border:1px #666666;\">".round(($sec+$msec)-$this->headtime,4)."</q>";
		$res = "<q style=\"position:relative; right:0; bottom:0;font-size:9px;color:#666666;border:1px #666666;\">".$this->Time()."</q>";
		$tm = Sslib::DB()->Timing();
		$dbt = 0;
		if(sizeof($tm))
		{
			
			$res.='<table style="border:0px;">';
			foreach($tm as $t)
			{
				$dbt+=$t[1];
				$res.='<tr><td><textarea style="width:400px;border:1px solid gray;font-size:9px;">'.$t[0].'</textarea></td><td style="font-size:10px;">'.$t[1].'</td></tr>';
			}
			$res.='</table>';
			$res.='Всего '.$dbt;
		}
		return $res;
	}
	function Time()
	{
		list($msec,$sec)=explode(chr(32),microtime());
		return round(($sec+$msec)-$this->headtime,4);
	}
	function __destruct()
	{
		$this->Draw();
	}
	
}

?>